package listener;

import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;

/**
 * 实现了 ServletContextAttributeListener 接口的类
 * 就是一个监听 ServletContext的属性的事件的监听器
 */
public class LmyServletContextAttributeListener implements ServletContextAttributeListener {

    @Override
    public void attributeAdded(ServletContextAttributeEvent scae) {

        System.out.println("LmyServletContextAttributeListener 监听到添加属性.." +
                scae.getName() + "=" + scae.getValue());
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent scae) {
        System.out.println("LmyServletContextAttributeListener 监听到删除属性.." +
                scae.getName() + "=" + scae.getValue());
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent scae) {
        System.out.println("LmyServletContextAttributeListener 监听到更新属性.." +
                scae.getName() + "=" + scae.getValue());
    }
}
